<include file="public@header" />
</head>
<body>
<div class="wrap">
	<ul class="nav nav-tabs">
		<li><a href="{:url('Goods/index')}">商品信息</a></li>
		<li><a href="{:url('Goods/add')}">添加商品</a></li>
		<li class="active"><a href="javascript :void(0)">编辑商品</a></li>
	</ul>
	<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('Goods/editpost')}">
		<div class="form-group">
			<label for="input-image" class="col-sm-2 control-label"><span class="form-required">*</span>图片</label>
			<div class="col-md-6 col-sm-10">
				<input id="photo-1" type="hidden" name="image"  value="{$Goods.image}">
				<input id="photo-1-name" type="text" name="image" value="{$Goods.image}" title="图片名称" class="form-control" readonly disabled>
			</div>
		</div>
		<div class="form-group">
			<label for="input-image" class="col-sm-2 control-label"></label>
			<div class="col-md-6 col-sm-10">
				<img id="photo-1-preview" style="width: 100px;" src="/upload/{$Goods.image}">
				<div>
					<a href="javascript:uploadOneImage('图片上传','#photo-1');" class="btn btn-primary">上传</a>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label for="name" class="col-sm-2 control-label"><span class="form-required">*</span>商品名称</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="name" name="name" value="{$Goods.name}">
			</div>
		</div>
		<div class="form-group">
			<label for="booklet" class="col-sm-2 control-label"><span class="form-required">*</span>图册</label>
			<div class="col-md-6 col-sm-10">
				<ul id="photos" class="pic-list unstyled" ></ul>
				<a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-wrapper');" class="btn btn-small">选择图片</a>
			</div>
		</div>
		<div class="form-group">
			<label for="freight" class="col-sm-2 control-label"><span class="form-required">*</span>运费</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="freight" name="freight" value="{$Goods.freight}" >
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">商品状态</label>
			<div class="col-md-6 col-sm-10">
				<label class="radio-inline">
					<input type="radio" name="status" value="1" checked> 正常
				</label>
				<label class="radio-inline">
					<input type="radio" name="status" value="2"> 下架
				</label>
				<label class="radio-inline">
					<input type="radio" name="status" value="0"> 无货
				</label>
			</div>
		</div>
		<div class="form-group">
			<label for="gid" class="col-sm-2 control-label"><span class="form-required">*</span>分类</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="gid" name="gid" value="{$Goods.gid}">
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<input type="hidden" name="__token__" value="{:token()}" />
				<button type="submit" class="btn btn-primary js-ajax-submit">保存</button>
			</div>
		</div>
		<input type="hidden" id="id" name="id" value="{$Goods.id}">
	</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="text/html" id="photos-item-wrapper">
	<li id="savedimage{id}">
		<input id="photo-{id}" type="hidden" name="photos_url[]" value="{filepath}">
		<input id="photo-{id}-name" type="text"  value="{name}" style="width: 160px;" title="图片名称">
		<img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;" onclick="parent.image_preview_dialog(this.src);">
		<a href="javascript:upload_one_image('图片上传','#photo-{id}');">替换</a>
		<a href="javascript:(function(){$('#savedimage{id}').remove();})();">移除</a>
	</li>
</script>
</body>
</html>